#!/usr/bin/env python
from distutils.core import setup, Extension
from sys import platform
from os import environ

if platform == 'win32':
    CFLAGS = []
    LIBS = []
    CLAMAVDEVROOT = environ.get('PYCLAMAV_DEVROOT')
    DEBUG = environ.get('PYCLAMAV_DEBUG', None)
    if DEBUG is not None:
        LIBFILE = 'contrib/msvc/Debug/libclamavd.lib'
    else:
        LIBFILE = 'contrib/msvc/Release/libclamav.lib'
    CLINCLUDE = ['/'.join([CLAMAVDEVROOT, 'libclamav'])]
    CLLIB = ['/'.join([CLAMAVDEVROOT, '', LIBFILE])]
else:
    CFLAGS = [ '-O2' ]
    LIBS = [ 'clamav' ]
    CLINCLUDE = [ '/usr/include' ]
    CLLIB = []

pyclamav = Extension('pyclamav',
                     sources = ['pyclamav.c'],
                     libraries = LIBS,
                     extra_objects = CLLIB,
                     extra_compile_args = CFLAGS)

# Build : python setup.py build
# Install : python setup.py install
# Register : python setup.py register

#  platform = 'Unix/Windows',
#  download_url = 'http://xael.org/norman/python/pyclamav/',

setup (name = 'pyclamav',
       version = '0.4.0-ClamWin',
       author = 'Alexandre Norman',
       author_email = 'norman()xael.org',
       license ='GPL',
       keywords="python, clamav, antivirus, scanner, virus, libclamav",
       url = 'http://xael.org/norman/python/pyclamav/',
       include_dirs = CLINCLUDE,
       description = 'This is a python binding to the C libclamav library (from the Clamav project - http://www.clamav.net). It can be used to easily allow a Python script to scan a file or a buffer against known viruses.',
       long_description = 'This is a python binding to the C libclamav library (from the Clamav project - http://www.clamav.net). It can be used to easily allow a Python script to scan a file or a buffer against known viruses.',
       ext_modules = [ pyclamav ])
